# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import gettext_lazy as _
from app_module.models.table_model import ClassModel, table_prefix


class TypeChoices(models.TextChoices):
    TYPE_ONE = 'ONE', _('TYPE_ONE')
    TYPE_TWO = 'TWO', _('TYPE_TWO')
    pass


class ChoicesModel(ClassModel):
    MODE_ONE = 1
    MODE_TWO = 2

    MODE_CHOICE = [
        (MODE_ONE, 'MODE_ONE'),
        (MODE_TWO, 'MODE_TWO'),
    ]

    mode_field = models.IntegerField(choices=MODE_CHOICE)

    type_field = models.CharField(
        max_length=4,
        choices=TypeChoices.choices,
        default=TypeChoices.TYPE_ONE,
    )

    class Meta:
        db_table = table_prefix + 'choices_name'
        verbose_name = '数据库表'
        verbose_name_plural = verbose_name
        pass

    pass
